#pragma once
#ifndef DEBUG_HHP
#define DEBUG_HHP
#include <stdio.h>
#include <stdlib.h>

//http://patrick.wagstrom.net/old/misc/dotfiles/dotbash_profile.html
#define BLACK         "\033[0;30m"
#define RED           "\033[0;31m"
#define GREEN         "\033[0;32m"
#define BROWN         "\033[0;33m"
#define BLUE          "\033[0;34m"
#define MAGENTA       "\033[0;35m"
#define CYAN          "\033[0;36m"
#define WHITE         "\033[0;37m"
#define LIGHTBLACK    "\033[1;30m"
#define LIGHTRED      "\033[1;31m"
#define LIGHTGREEN    "\033[1;32m"
#define YELLOW        "\033[1;33m"
#define LIGHTBLUE     "\033[1;34m"
#define LIGHTMAGENTA  "\033[1;35m"
#define LIGHTCYAN     "\033[1;36m"
#define LIGHTWHITE    "\033[1;37m"
#define NONE          "\033[0m"  

#define ERROR(message) \
printf("%sERROR: %s%s\n",RED,message,NONE);
#define READING_ERROR(message,i)  \
  (i==0) ? printf("%sERROR: %s%s\n",RED,message,NONE):\
  printf("%sERROR: %s%d%s\n",RED,message,i,NONE);

  
#ifdef DEBUG

// Asserts expr expression, if false exits with error
#define ASSERT(expr, message) if(expr==false)printf("%sASSERTION ERROR: %s in line %d of file: \"%s\" %s\n"\
  ,BLUE,message,__LINE__,__FILE__,NONE);if(expr==false) exit(1);

#define INFO(message)  ...

#define WARN(message)  \
printf("%sWARNING: %s%s\n",YELLOW,message,NONE);

#else
#define ASSERT(expr, message) 
#define INFO(message)
#define WARN(message) \
printf("%sWARNING: %s%s\n",YELLOW,message,NONE);

#endif //DEBUG
#endif // DEBUG_HHP
